package src;

public class persistenzManager  {
	private SynchronizedCounter myCount; 
	private dataManager dm;
	protected static persistenzManager itsInstance;
	
	public static synchronized persistenzManager getInstance(){
		if( itsInstance == null )
	        itsInstance = new persistenzManager();
	      return itsInstance;
	}
	
	private persistenzManager() {
		myCount = new SynchronizedCounter();
		dm = new dataManager();
	}
	
	public int beginTransaction() {
		dm.readLogFile();
		return myCount.incrementAndGet();
	}
	
	public void commit (int taid){
		dm.pruefePuffer(taid);
	}
	
	public void write(int taid, int pageid, String data){
		dm.write(taid, pageid, data);
	}
}
